<?php /*a:8:{s:68:"E:\code\jiaoyou\application\admin\view\settings\extension_bonus.html";i:1599530032;s:57:"E:\code\jiaoyou\application\admin\view\public\header.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\css.html";i:1598939754;s:53:"E:\code\jiaoyou\application\admin\view\public\js.html";i:1598939754;s:58:"E:\code\jiaoyou\application\admin\view\public\tophead.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\top.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\footer.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\bottom.html";i:1598939754;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>后台系统</title>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/animate.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/style.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/ffxiang.css" />
<link rel="shortcut icon" href="http://jiaoyou.com\/style/admin/img/favicon.ico">
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/layui/css/layui.css" />
</head>
<style type="text/css">
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .btn-active {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <?php 
$controller=strtolower(request()->controller());
$action=strtolower(request()->action());
$adminCtegory=db('category')->where(['controller'=>$controller,'function'=>$action])->cache(_cache('db'))->find();
$admin = Session::get('admin', 'mmjtAdmin');

if ($admin['id'] != 1 && $admin['type'] != 1) {
  $auth_visit = Db::name('admin_type')->where(['id' => $admin['type']])->value('data');
  $auth_visit = json_decode($auth_visit, true);
}else{
  $auth_visit = Db::name('category')->column('id');
}
if($adminCtegory){
	$adminCtegoryTid=db('category')->where(['tid'=>$adminCtegory['id'],'hideright'=>1])->order('des asc,id asc')->cache(_cache('db'))->select();
}else{
  $adminCtegoryTid=[];
}
 ?>
<div class="">
	<?php if(is_array($adminCtegoryTid) || $adminCtegoryTid instanceof \think\Collection || $adminCtegoryTid instanceof \think\Paginator): $i = 0; $__LIST__ = $adminCtegoryTid;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;
  $get=$v['get'];
  $geturl=[]; 
  if($get){
    if(strstr($get,"|")){
      $tidexplode=explode("|",$get);
      foreach($tidexplode as $va){
        $geturl[$va]=input($va);
      }
    }else{
        $geturl[$get]=input($get);
    }
  }
  $geturl['url']='-1';
  $url=url($v['controller'].'/'.$v['function'],$geturl);
   if(in_array($v['id'],$auth_visit)): ?><a onclick="add('<?php echo htmlentities($url); ?>')" href="javascript:void(0);" class="btn btn-primary "><?php echo htmlentities($v['title']); ?></a><?php endif; ?>
  <?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<script type="text/javascript">
function add(url){
        layer.open({
          type: 2,
          title: '提示',
          shadeClose: false,
          shade: 0.2,
          area: ['90%', '90%'],
          skin:'shangchuantup',
          shift:-1,
          content: url,
          scrollbar: false,
          moveType: 1,
          moveOut: true
        }); 
}
</script>
        <div class="ibox-title">
<h5>
<?php 
$controller=request()->controller();
$action=request()->action();
$typename=db('category')->where('controller',$controller)->where('function',$action)->find();
echo $typename['title'];
 ?></h5>
</div>
        <form class="form-horizontal" method="post">

            <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">

                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">

                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">



                            <!--推广奖start-->
                            <?php foreach($sexs as $key=>$val): ?>

                            <div class="form-group-title"><?php echo htmlentities($val); ?>士推广奖    <?php if($development_display): ?><span style="color: red;">推广奖：extension[val][上级性别即<?php echo htmlentities($key); ?>][上级代数][下级性别]，上级是否vip：extension[is_vip][上级性别即<?php echo htmlentities($key); ?>][上级代数]，上级是否需要实名：extension[is_realname][上级性别即<?php echo htmlentities($key); ?>][上级代数]，总代数：extension[g][上级性别即<?php echo htmlentities($key); ?>]</span><?php endif; ?>
                            </div>
                            <table data-toggle="table"  id="extension_table_<?php echo htmlentities($key); ?>">
                                <!--red_table_上级性别-->
                                <?php 
                                    $g = compare_val($extension['g'][$key],0)?0:$extension['g'][$key];
                                    $g = $g?:0;
                                 ?>
                                <!--默认代数-->
                                <input type="hidden" name="extension[g][<?php echo htmlentities($key); ?>]" value="<?php echo htmlentities($g); ?>" id="extension_num_<?php echo htmlentities($key); ?>" />

                                <h4 style="padding: 0 0px 10px 10px;">
                                    <a href="javascript:;" onclick="addOptions('extension_table_<?php echo htmlentities($key); ?>',<?php echo htmlentities($key); ?>);" title="添加代数" class="btn btn-primary"><i class="fa fa-plus"></i> 添加代数</a>
                                    <a href="javascript:;" onclick="removeOptions('extension_table_<?php echo htmlentities($key); ?>',<?php echo htmlentities($key); ?>);" title="删除代数" class="btn btn-primary"><i class="fa fa-remove"></i> 删除代数</a>
                                </h4>
                                <thead>
                                <tr>
                                    <th data-align="center">代数</th>
                                    <?php foreach($sexs as $k=>$v): ?>
                                    <th data-align="center">推荐<?php echo htmlentities($v); ?>士奖励</th>
                                    <?php endforeach; ?>
                                    <th data-align="center">上级是否VIP</th>
                                    <th data-align="center">上级是否需要实名</th>

                                </tr>
                                </thead>
                                <tbody id="form">
                                <?php $__FOR_START_662489491__=1;$__FOR_END_662489491__=$g+1;for($i=$__FOR_START_662489491__;$i < $__FOR_END_662489491__;$i+=1){ ?>
                                    <!--tjj_num_上级性别_第几代-->
                                    <tr class="class" id="extension_num_<?php echo htmlentities($key); ?>_<?php echo htmlentities($i); ?>">
                                        <td><?php echo htmlentities($i); ?>代</td>
                                        <?php foreach($sexs as $k_td=>$v_td): ?>

                                        <td><input type="text" name="extension[val][<?php echo htmlentities($key); ?>][<?php echo htmlentities($i); ?>][<?php echo htmlentities($k_td); ?>]" class="form-control" value="<?php echo compare_val($extension['g'][$key],0)?'':$extension['val'][$key][$i][$k_td];?>" /></td>
                                        <?php endforeach; ?>

                                        <td>
                                            <input type="radio" name="extension[is_vip][<?php echo htmlentities($key); ?>][<?php echo htmlentities($i); ?>]" value="1"
                                                   <?php if(radio_checked($extension['is_vip'][$key][$i],1)): ?>checked="checked"<?php endif; ?> /> 是
                                            <input type="radio" name="extension[is_vip][<?php echo htmlentities($key); ?>][<?php echo htmlentities($i); ?>]" value="0"
                                                   <?php if(radio_checked($extension['is_vip'][$key][$i],0)): ?>checked="checked"<?php endif; ?>
                                            /> 否
                                        </td>

                                        <td>
                                            <input type="radio" name="extension[is_realname][<?php echo htmlentities($key); ?>][<?php echo htmlentities($i); ?>]" value="1"
                                                   <?php if(radio_checked($extension['is_realname'][$key][$i],1)): ?>checked="checked"<?php endif; ?> /> 需要
                                            <input type="radio" name="extension[is_realname][<?php echo htmlentities($key); ?>][<?php echo htmlentities($i); ?>]" value="0"
                                                   <?php if(radio_checked($extension['is_realname'][$key][$i],0)): ?>checked="checked"<?php endif; ?>
                                            /> 不需要
                                        </td>
                                    </tr>
                                <?php } ?>



                                </tbody>
                            </table>
                            <hr>
                            <?php endforeach; ?>
                            <!--推广奖end-->
                    </div>
                </div>
            </div>
            <hr>


        </div>
        </form>
    </div>
</div>
     
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/content.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.css" />
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/ffxiangIndex.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/common.js"></script>
</body>
</html>
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.css" />
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table-zh-CN.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/iCheck/custom.css" />
<script type="text/javascript">
$(document).ready(function(){
    $("#button").click(function(){

      <?php 
      if((request()->controller()=='Article' && request()->action()=='add') || (request()->controller()=='Shop' && request()->action()=='add')){
       ?>

      var images='';
      <?php if(!empty($name)){ ?>
      $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+='"'+img
          }else{
            images+=',"'+img
          }
        }
      });
      if(images){
        images="{"+images+"}";
        $('#images').val(images);
      }else{
        $('#images').val();
      }

      <?php }else{?>
       $(".meiyouuimmag textarea").each(function(ret){
        var img=$(this).data('img');
        if(img){
          img_text=$(this).val();
          if(ret==0){
            images+=''+img
          }else{
            images+=','+img
          }
        }
      });
      if(images){
        $('#images').val(images);
      }else{
        $('#images').val();
      }
        <?php }} 
if(input('?url')){
  echo 'loading("#button button")'."\r\n";
}
 ?>

        ajaxFun("POST","",$(".form-horizontal").serialize(),"json",function(ret){
            if(ret){
                if(ret.ret){
                    swal_msg(ret.ret,'',"success",<?php if(input('?url')){echo input('url');}else{echo 0;} ?>)
                    <?php 
if(input('?url')){
  echo 'loading("#button button",\'<i class="fa fa-check"></i> &nbsp;\'+ret.ret)';
}
 ?>

                    return false;
                }else{
                    layer.msg(ret.err)
                }
            }else{
                swal_msg("错误",ret,"error");
            }
            <?php 
if(input('?url')){
 ?>
loadingClose("#button button",'<i class="fa fa-check"></i> &nbsp;<?php if(isset($name)): ?>修改<?php else: ?>提交<?php endif; ?>')
<?php 
}
 ?>

        });
    });
});

function html2Escape(sHtml) {
 return sHtml.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
}
</script>
<style type="text/css">
.tbutton{ 
  position: fixed;
  bottom:0px;
  width: 100%;
  background: #fff;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid #F5EFEF;
  z-index: 99999999999
}
#button{ width:120px; margin: 0 auto;}
.wrapper-content{ margin-bottom:75px;}
</style>

<div class="tbutton">
  <div id="button"><button class="btn btn-w-m btn-primary" type="button"><i class="fa fa-check"></i> &nbsp;<?php if(isset($name)): ?>修改<?php else: ?>提交<?php endif; ?></button></div>
</div>

<script language="javascript">
    function addOptions(table,key){
        var sex_name = key==1?'男':'女';
        var num = parseInt($('#extension_num_'+key).val());
        if(num == 0){
            $('#extension_table_'+key+' .no-records-found').remove();
        }
        var new_num = num + 1;
        // tjj_num_上级性别_第几代
        var html = '<tr class="class" id="extension_num_'+key+'_'+new_num+'">'+
                        '<td style="text-align: center; ">'+new_num+'代</td>';

        <?php if(is_array($sexs) || $sexs instanceof \think\Collection || $sexs instanceof \think\Paginator): $i = 0; $__LIST__ = $sexs;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
            html +=     '<td style="text-align: center; ">' +
                            '<input type="text" name="extension[val]['+key+']['+new_num+'][<?php echo htmlentities($key); ?>]" class="form-control" value="" />' +
                        '</td>';
        <?php endforeach; endif; else: echo "" ;endif; ?>
            html +=     '<td style="text-align: center; ">'+
                '<input type="radio" name="extension[is_vip]['+key+']['+new_num+']" value="1" /> 是' +
                '<input type="radio" name="extension[is_vip]['+key+']['+new_num+']" value="0" checked="checked" /> 否' +
                '</td>';
            html +=     '<td style="text-align: center; ">'+
                            '<input type="radio" name="extension[is_realname]['+key+']['+new_num+']" value="1" /> 需要' +
                            '<input type="radio" name="extension[is_realname]['+key+']['+new_num+']" value="0" checked="checked" /> 不需要' +
                        '</td>' +
                  '</tr>';

            $('#extension_table_'+key).append(html);
            if(new_num >= 0){
                $('#extension_num_'+key).val(new_num)
            }
        }

        //删除最后的一代
        function removeOptions(table,key){
            var num = parseInt($('#extension_num_'+key).val());
            var new_num = num - 1;

            $('#extension_num_'+key+'_'+num).remove();
            if(new_num >= 0){
                $('#extension_num_'+key).val(new_num)
            }
            if(new_num == 0){
                $('#extension_num_'+key).val(new_num);
                var html = '<tr class="no-records-found"><td colspan="<?php echo htmlentities($sex_num+2); ?>">没有找到匹配的记录</td></tr>';
                $('#extension_table_'+key).append(html);
            }
        }

</script>